#pragma once

#include <chrono>
#include <thread>

namespace behavior_controller {
namespace time {

class SteadyClock {
public:
    typedef std::chrono::steady_clock Clock;
    typedef std::chrono::steady_clock::time_point TimePoint;
    typedef std::chrono::steady_clock::duration Duration;

    static const char *Type() { return "time::SteadyClock"; }

    static TimePoint Now() { return Clock::now(); }

    static int64_t NowTimestamp() { return Now().time_since_epoch().count(); }

    template<typename Duration>
    static void SleepFor(const Duration &dura) {
        std::this_thread::sleep_for(dura);
    }

    static void SleepUntil(const TimePoint &tp) {
        std::this_thread::sleep_until(tp);
    }
};

} // namespace time
} // namespace behavior_controller
